package com.geniusk.system.controller;

import com.geniusk.common.config.IoTConfig;
import com.geniusk.common.core.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 首页展示接口
 */
@RestController
@RequestMapping("/system/index")
public class IndexController {

    @Autowired
    private IoTConfig ioTConfig;

    /**
     * 获取欢迎信息
     */
    @GetMapping("/sayWelcome")
    public JSONResult sayWelcome(){
        return JSONResult.ok("欢迎使用GK物联网后台系统，请通过前端地址访问");
    }

    /**
     * 获取首页
     */
    @GetMapping("/getIndexInfo")
    public JSONResult getIndexInfo(){

        Map<String,Object> result = new HashMap<>();
        result.put("platformName",ioTConfig.getPlatformName());
        result.put("platformVersion",ioTConfig.getPlatformVersion());
        result.put("videoUrl","https://emos-1307515289.cos.ap-beijing.myqcloud.com/video/cloudAquarium.mp4");
        return JSONResult.ok(result);
    }
}
